<?php

/**
 * CharacterTemplate form.
 *
 * @package    WTE
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class CharacterTemplateForm extends BaseCharacterTemplateForm
{
  public function configure()
  {
  	unset($this['created_at'], $this['updated_at']);
	
	$this->widgetSchema->setLabels(array(
		'introduced_by' => 'Introduit par',
		'name' => 'Nom',
		'avatar' => 'Photo',
		'desc_EN' => 'Description anglaise',
		'desc_FR' => 'Description française',
		'desc_ES' => 'Description espagnole',
		'rel_EN' => 'Relation anglaise',
		'rel_FR' => 'Relation française',
		'rel_ES' => 'Relation espagnole',		
	));
	
	// To keep
	if(!$this->getObject()->isNew())
		$this->widgetSchema['introduced_by']->setOption('query', Doctrine_Query::CREATE()->from('CharacterTemplate t')->where('t.id != ?', $this->getObject()->getId()));
	
	$this->validatorSchema['name'] = new sfValidatorAnd(array(
    $this->validatorSchema['name'],
    new sfValidatorString(array('min_length' => 2)),
  ));
  }
}
